#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using pii = pair<int, int>;
#define rep(i, a, b) for (int i = (a); i <= (b); i++)
#define per(i, a, b) for (int i = (a); i >= (b); i--)
#define endl '\n'
const int N = 2e5 + 5;

string rotate(string s) {
  // 0 1 2 3 4 5
  // 0 3 1 4 2 5
  string t = s;
  char c = t[1];
  t[1] = t[3];
  t[3] = t[4];
  t[4] = t[2];
  t[2] = c;
  return t;
}
string up(string s) {
  // 0 1 2 3 4 5
  // 1 5 2 3 0 4
  string t = s;
  char c = t[0];
  t[0] = t[1];
  t[1] = t[5];
  t[5] = t[4];
  t[4] = c;
  return t;
}

bool solve(string s) {
  string a = s.substr(0, 6), b = s.substr(6);
  string s1 = up(a);
  string s2 = up(s1);
  string s3 = up(s2);
  string s4 = up(rotate(a));
  string s5 = up(up(s4));
  vector<string> v{a, s1, s2, s3, s4, s5};
  for (string p : v) {
    if (p == b) return true;
    rep(i, 1, 3) {
      p = rotate(p);
      if (p == b) return true;
    }
  }
  return false;
}
int main() {
  ios::sync_with_stdio(0), cin.tie(0), cout.tie(0);
  string s;
  while (cin >> s) {
    cout << (solve(s) ? "TRUE\n" : "FALSE\n");
  }
  return 0;
}